<template>
	<div>
		<el-card shadow="never">
			<div style="text-align: left;">
				<el-input class="x_soso" v-model="searchInput" placeholder="请输入绑定门店名称/绑定店长名称/绑定代理商名称搜索"></el-input>
				<el-button type="primary" @click="searchList">查询</el-button>

			</div>
			<div style="text-align: left;">
				<el-button type="primary" @click='reloadVal'>刷新</el-button>
			</div>
			<div style="clear:both"></div>
			<el-table v-loading="loading" :data="tableData" style="width: 100%;margin-top: 20px">
				<el-table-column type="index" width="50"></el-table-column>
				<el-table-column label="工单号" align="center" width="150" prop="equUseId"></el-table-column>
				<el-table-column label="设备名称" align="center" width="150" prop="equName"></el-table-column>
				<el-table-column label="客户名称" align="center" width="150" prop="personName"></el-table-column>
				<el-table-column label="店铺名称" align="center" width="150" prop="shopName"></el-table-column>
				<el-table-column label="店长名称" align="center" width="150" prop="memName"></el-table-column>
				<el-table-column label="电话" align="center" width="200" prop="memPhone"></el-table-column>
				<el-table-column label="代理商名称" align="center" width="150" prop="ageName"></el-table-column>
				<el-table-column label="代理商电话" align="center" width="150" prop="agePhone"></el-table-column>
				<el-table-column label="方案名称" align="center" width="150" prop="planName"></el-table-column>
				<el-table-column label="耗点价格" align="center" width="150" prop="dotPrice"></el-table-column>
				<el-table-column label="点数数量" align="center" width="150" prop="dotNum"></el-table-column>
				<el-table-column label="开始时间" align="center" width="180" prop="startTime"></el-table-column>
				<el-table-column label="结束时间" align="center" width="180" prop="endTime"></el-table-column>
			</el-table>
			<div style="margin-top: 20px;text-align: right">
				<el-pagination background @current-change="columnFind" :current-page="page.page" :page-size="page.pagesize" layout="prev, pager, next, jumper, total"
				 :total="page.count"></el-pagination>
			</div>
		</el-card>
	</div>
</template>

<script>
	import Cookie from 'js-cookie';
	import {
		equUseList
	} from '../../../server/index.js';
	export default {
		inject: ['reload'],
		data() {
			return {
				//查询
				searchInput: '',
				loading: true,
				tableData: [],
				page: {
					count: 0,
					pagesize: 10,
					page: 1
				}
			};
		},
		mounted() {
			var page = 1;
			this.columnFind(page);
			Cookie.remove('tabList');
		},
		methods: {
			// 刷新方法
			reloadVal() {
				this.reload();
			},
			// 查询、
			searchList() {
				this.columnFind(1);
			},
			columnFind(page) {
				const _this = this;
				_this.page.page = page;
				let obj = {
					page: _this.page.page,
					rows: _this.page.pagesize,
					keyword: undefined == _this.searchInput ? '' : _this.searchInput,
				};
				_this.http.request({
					url: equUseList,
					data: obj,
					success: function(res) {
						_this.loading = false;
						_this.tableData = res.list;
						_this.page.count = res.total;
					},
					error: function(err) {
						_this.$message({
							offset: '200',
							message: err.msg
						})
					}
				});
			}
		}
	};
</script>

<style scoped="scoped" lang="less">
	.el-button--primary {
		background: rgba(113, 106, 202, 1);
		border: none;
	}

	.el-button--primary:hover {
		color: #606266;
		background: rgba(255, 255, 255, 1);
		border: 1px solid rgba(113, 106, 202, 1);
	}
</style>
